<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/5/9
  Time: 20:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>修改密码</title>
</head>
<body>
<div style="border: 1px solid #E6E6E6;width: 350px;margin:auto;">
    <form id="updatePwdForm" style="margin-top: 20px;font-size: 15px;font-family: 微软雅黑;">
        <div style="margin-bottom:20px;text-align: center;">
            <input class="easyui-textbox" name="oldPwd" data-options="label:'旧密码',width:300,height:30,required:true,missingMessage:'旧密码不能为空！'">
        </div>
        <div style="margin-bottom:20px;text-align: center;">
            <input class="easyui-textbox" name="newPwd" data-options="label:'新密码',width:300,height:30,required:true,missingMessage:'新密码不能为空！'">
        </div>
    </form>
    <div style="text-align:center;padding:5px 0">
        <a class="easyui-linkbutton" onclick="submitForm()" style="width:80px">提交</a>
        <a class="easyui-linkbutton" onclick="clearForm()" style="width:80px">重置</a>
    </div>
</div>
<script>
    $(function () {
        $('#updatePwdForm').form({
            url:'${pageContext.request.contextPath}/admin/updatePwd',
            type:'post',
            success:function(data){
                var data = eval('(' + data + ')');
                $.messager.alert('提示', data.message, 'info');
                $.messager.alert({
                    title: '提示',
                    msg: data.message,
                    fn: function(){
                        if (data.message === '修改成功！') {
                            location.href = 'logout';
                        }
                    }
                });
            }
        });
    });

    function clearForm() {
        $('#updatePwdForm').form('clear');
    }

    function submitForm() {
        $('#updatePwdForm').form('submit');
        $('#updatePwdForm').form('clear');
    }
</script>
</body>
</html>
